/*
 * $Id: QEExchangeElement.h 248 2008-09-08 15:31:38Z jon $
 * Sleeper
 *
 * Created by Jon Gordon on 7/24/08
 * Copyright Jon Gordon.  All rights reserved.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining 
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including 
 * without limitation the rights to use, copy, modify, merge, publish, 
 * distribute, sublicense, and/or sell copies of the Software, and to 
 * permit persons to whom the Software is furnished to do so, subject to 
 * the following conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */


#import <Cocoa/Cocoa.h>

//
// Model element, class representing one element in a contest 
// exchange--one is configured for each element in exchange. Note that 
// the object represents the element as such, not any particular value 
// for the element.
//
// Author: $Author: jon@bway.net $
// Revision: $Revision: 2 $
//
@interface QEExchangeElement : NSObject

//
// Initializer that takes the name of the element as a selector.
//
// parameters:
//  name - name of element that this instance will represent
//
+ (QEExchangeElement *)elementForName:(NSString *)name;


//
// Indicates whether the token represents a valid value for this element.
//
// parameter:
//  stringValue - 
- (BOOL)isLegalValueInString:(NSString *)stringValue;

//
// Returns an object of the type appropriate for this element, containing the
// value corresponding to the input string.  If the string cannot be converted
// to a legal value, then nil is returned.
//
// parameter:
//   stringValue - NSString representation of a hopefully-legal value for
//                 this element
//
// return:
//   instance of appropriate class to hold the value corresponding to the contents
//   of stringValue, or nil if no such value can be found or calculated
- (id)valueForString:(NSString *)stringValue;

//
// Gets the element name.
//
// return:
//  the element name
//
- (NSString *)elementName;
@end
